package com.snail.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.snail.mapper.BizTaskAuditMapper;
import com.snail.model.entity.AddBizTaskAuditRequest;
import com.snail.model.pojo.BizTaskAudit;
import com.snail.model.pojo.SysTeam;
import com.snail.service.BizTaskAuditService;
import jakarta.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

/**
* @author Monica
* @description 针对表【biz_task_audit(任务审核表)】的数据库操作Service实现
* @createDate 2025-07-23 14:30:24
*/
@Service
public class BizTaskAuditServiceImpl extends ServiceImpl<BizTaskAuditMapper, BizTaskAudit>
    implements BizTaskAuditService{

    @Resource
    private SysTeamServiceImpl sysTeamService;

    @Override
    public void addBizTaskAudit(AddBizTaskAuditRequest request) {
        Long taskId = request.getTaskId();
        Long userId = request.getUserId();
        String auditContent = request.getAuditContent();

        Long teamId = request.getTeamId();
        // 根据teamId获取auditorId
        SysTeam team = sysTeamService.getById(teamId);
        Long auditorId = team.getCreatorId();
        BizTaskAudit bizTaskAudit = new BizTaskAudit();
        BeanUtils.copyProperties(request, bizTaskAudit);
        bizTaskAudit.setAuditorId(auditorId);
        save(bizTaskAudit);
    }
}




